πŸ•ΈοΈ Ada Research Browser

development.md
← Back

Development Guide

Setup

# Clone repository
git clone https://github.com/Quig-Enterprises/cyber-guardian.git
cd cyber-guardian

# Install dependencies
pip install -e '.[dev]'

# Copy and configure
cp config.yaml config.local.yaml
# Edit config.local.yaml with your settings

# Set environment variables
export DB_PASSWORD="your-db-password"
export REDTEAM_SYSADMIN_PASS="test-password"

Running Tests

# All tests
pytest

# Specific category
pytest tests/test_ai_attacks.py
pytest tests/test_api_attacks.py

# With coverage
pytest --cov=cyberguardian --cov-report=html

Project Structure

cyber-guardian/
β”œβ”€β”€ cyberguardian/       # CLI package
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── cli.py           # Main entry point
β”‚
β”œβ”€β”€ redteam/             # Red Team (Offensive)
β”‚   β”œβ”€β”€ attacks/         # Attack modules
β”‚   β”œβ”€β”€ evaluators/      # Result evaluators
β”‚   β”œβ”€β”€ reporters/       # Report generators
β”‚   └── cleanup/         # Artifact cleanup
β”‚
β”œβ”€β”€ blueteam/            # Blue Team (Defensive)
β”‚   β”œβ”€β”€ collectors/      # Log/event collectors
β”‚   β”œβ”€β”€ correlator/      # Event correlation
β”‚   β”œβ”€β”€ alerting/        # Alert engine
β”‚   β”œβ”€β”€ compliance/      # Compliance tracking
β”‚   β”œβ”€β”€ incident/        # Incident response
β”‚   └── reports/         # Compliance reports
β”‚
β”œβ”€β”€ shared/              # Common infrastructure
β”‚   β”œβ”€β”€ auth.py          # Authentication client
β”‚   β”œβ”€β”€ database.py      # Database utilities
β”‚   └── config.py        # Config loader
β”‚
β”œβ”€β”€ docs/                # Documentation
β”œβ”€β”€ tests/               # Integration tests
└── reports/             # Generated reports

Adding a New Attack Module

  1. Create attack file in redteam/attacks/{category}/
  2. Inherit from Attack base class
  3. Implement execute() and evaluate() methods
  4. Add to registry by importing in redteam/attacks/{category}/__init__.py

Example:

from redteam.base import Attack, AttackResult

class NewAttack(Attack):
    name = "category.new_attack"
    category = "ai"
    severity = "high"
    description = "Description of attack"

    async def execute(self, client):
        # Run attack
        response = await client.post("/api/endpoint", json={...})

        return [AttackResult(
            attack_name=self.name,
            variant="variant1",
            status="vulnerable" if success else "defended",
            severity=self.severity,
            evidence=response.text,
            details="Explanation",
            request={...},
            response={...},
            duration_ms=elapsed
        )]

    def evaluate(self, result):
        # Score the result
        pass

Adding a Blue Team Collector

  1. Create collector file in blueteam/collectors/
  2. Inherit from Collector base class
  3. Implement collect() method
  4. Register in blueteam/collectors/__init__.py

Code Style

Run formatters:

black .
ruff check --fix .

Git Workflow

  1. Create feature branch from main
  2. Make changes
  3. Run tests
  4. Commit with descriptive message
  5. Push and create PR

Versioning

Update version in: - pyproject.toml - cyberguardian/__init__.py - README.md

Release Process

  1. Update version numbers
  2. Update CHANGELOG.md
  3. Tag release: git tag v1.0.0
  4. Push tags: git push --tags
  5. GitHub Actions will build and publish